package xyz.sicau.test0;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer {
    public static final String QUEUE = "hello";
    public static void main(String[] args) throws IOException, TimeoutException {
        ConnectionFactory connectionFactory = new ConnectionFactory();
        connectionFactory.setHost("sicau.xyz");
        connectionFactory.setUsername("admin");
        connectionFactory.setPassword("12345qaZ");
        Connection connection = connectionFactory.newConnection();

        Channel channel = connection.createChannel();

        channel.queueDeclare(QUEUE, false, false,false,null);
        channel.basicPublish("",QUEUE,null,"哈哈哈哈".getBytes("utf-8"));
    }
}
